package com.tesis_2.UI;

import java.util.ArrayList;

import org.json.JSONException;

import com.example.t2_clientback.R;
import com.example.t2_clientback.R.layout;
import com.example.t2_clientback.R.menu;
import com.tesis_2.BL.BLPlatos;
import com.tesis_2.MO.MOPlato;
import com.tesis_2.Utils.UTPlatosMasConsumidos;
import com.tesis_2.Utils.UTRestaurantsAdapter;

import android.os.Bundle;
import android.app.Activity;
import android.app.ListActivity;
import android.view.Menu;

public class UIPlatosMasConsumidos extends ListActivity {

	int nRest;
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		//setContentView(R.layout.activity_uiplatos_mas_consumidos);
		ArrayList<MOPlato> lsPLatos = new ArrayList<MOPlato>();
		Bundle b = getIntent().getExtras();
		nRest = b.getInt("RestId");
		try {
			lsPLatos = BLPlatos.getPlatosMasConsumidos(nRest);
		} catch (JSONException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		
		setListAdapter( new UTPlatosMasConsumidos(this, lsPLatos));
	}

	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		// Inflate the menu; this adds items to the action bar if it is present.
		getMenuInflater()
				.inflate(R.menu.activity_uiplatos_mas_consumidos, menu);
		return true;
	}

}
